luci-mod-system: add interface selection for NTPD
authorAlexey Dobrovolsky <[email protected]>
Wed, 4 May 2022 22:18:51 +0000 (01:18 +0300)
committerAlexey Dobrovolsky <[email protected]>
Thu, 5 May 2022 21:08:18 +0000 (00:08 +0300)
UCI option `interface` for sysntpd server was introduced in
OpenWrt commit 4da60500ebd2. NTP server binds to the specified interface,
or if unspecified, to all.

This patch adds selection widget to LuCI.

Signed-off-by: Alexey Dobrovolsky <[email protected]>
modules/luci-mod-system/htdocs/luci-static/resources/view/system/system.js

index 082a923c81ec1c0153d53c2e897bb2b18a27fe7e..767bc8c619fb14f756ccbcf56bb617e99ca8827d 100644 (file)
@@ -5,6 +5,7 @@
 'require uci';
 'require rpc';
 'require form';
+'require tools.widgets as widgets';
 
 var callInitList, callInitAction, callTimezone,
     callGetLocaltime, callSetLocaltime, CBILocalTime;
@@ -282,6 +283,15 @@ return view.extend({
                        o.ucisection = 'ntp';
                        o.depends('enabled', '1');
 
+                       o = s.taboption('timesync', widgets.NetworkSelect, 'interface',
+                               _('Bind NTP server'),
+                               _('Provide the NTP server to the selected interface or, if unspecified, to all interfaces'));
+                       o.ucisection = 'ntp';
+                       o.depends('enable_server', '1');
+                       o.multiple = false;
+                       o.nocreate = true;
+                       o.optional = true;
+
                        o = s.taboption('timesync', form.Flag, 'use_dhcp', _('Use DHCP advertised servers'));
                        o.ucisection = 'ntp';
                        o.default = o.enabled;